<?php

namespace App\Admin\Controllers;

use App\Admin\Repositories\ReceptionLog;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;

class ReceptionLogController extends AdminController
{

    public bool $create = false;
    public bool $edit = false;
    public bool $delete = false;
    public bool $disable_actions = true;

    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid(): Grid
    {
        return Grid::make(new ReceptionLog(), function (Grid $grid) {
            $grid->model()->orderByDesc('id');
            $grid->column('id');
            $grid->column('user_name');
            $grid->column('created_at');
            //$this->gridCommon($grid);
            $grid->disableCreateButton()->disableActions();
        });
    }

    /**
     * Make a show builder.
     *
     * @param mixed $id
     *
     * @return Show
     */
    protected function detail($id)
    {
        return Show::make($id, new ReceptionLog(), function (Show $show) {
            $show->field('id');
            $show->field('type');
            $show->field('user_ids');
            $show->field('created_at');
            $show->field('updated_at');
        });
    }

    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function form()
    {
        return Form::make(new ReceptionLog(), function (Form $form) {
            $form->display('id');
            $form->text('type');
            $form->text('user_ids');

            $form->display('created_at');
            $form->display('updated_at');
        });
    }
}
